package com.ivo.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.ivo.model.Model;

@Entity
@Table (name = "PDM_O_STAT")
public class Status extends Model {
	private static final long serialVersionUID = 613370075894848525L;
	
	private String statusId;
	private String statusName;
	private short forCate;
	private short forClass;

	public Status(){}

	@Id
	@Column(name = "STAT_ID", length=10)
	public String getStatusId() {
		return statusId;
	}

	public void setStatusId(String statusId) {
		this.statusId = statusId;
	}
	
	@Column(name = "STAT_NAME", length=100)
	public String getStatusName() {
		return statusName;
	}

	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}

	@Column(name = "FOR_CATE")
	public short getForCate() {
		return forCate;
	}

	public void setForCate(short forCate) {
		this.forCate = forCate;
	}

	@Column(name = "FOR_CLASS")
	public short getForClass() {
		return forClass;
	}

	public void setForClass(short forClass) {
		this.forClass = forClass;
	}
	
	@Transient
	public boolean isUnstarted() {
		return this.statusId.equals("100");
	}
	
	@Transient
	public boolean isOnGoing() {
		return this.statusId.equals("500");
	}
	
	@Transient
	public boolean isDelayed() {
		return this.statusId.equals("800");
	}
	
	@Transient
	public boolean isFinished() {
		return this.statusId.equals("900") || statusId.equals("910");
	}
	
	@Transient
	public boolean notFinished() {
		return !isFinished();
	}
	
	@Transient
	public String getFullName() {
		return "[" + this.statusId + "]" + this.statusName;
	}

}
